package com.zhengtoudai.ui.presenter;

import com.zhengtoudai.http.HttpApi;
import com.zhengtoudai.injector.PerActivity;
import com.zhengtoudai.ui.bean.DelegationNominis;
import com.zhengtoudai.ui.view.DelegatioNominisView;

import javax.inject.Inject;

import rx.Observer;

/**
 * Created by Administrator on 2016/8/26 0026.
 */
@PerActivity
public class DelegatioNominisPresenterImpl extends BasePresenterImpl<DelegatioNominisView> implements DelegatioNominisPresenter {

    @Inject
    public DelegatioNominisPresenterImpl(){

    }

    @Override
    public void borrowTransfer(int numPerPage, int pageNum) {
        mSubscription= HttpApi.getInstance().borrowTransfer(numPerPage, pageNum)
                .subscribe(new Observer<DelegationNominis>() {
                    @Override
                    public void onCompleted() {
                        mView.onComplete();
                    }

                    @Override
                    public void onError(Throwable e) {
                        mView.onFailure(e);
                        mView.onComplete();
                    }

                    @Override
                    public void onNext(DelegationNominis delegationNominis) {
                        mView.onResult(delegationNominis);
                    }
                });
    }
}
